;(function (global){
	// 用户操作地址
	var CGI = {
		SET_USER_BANK: window.frontPath + 'user/content/setUserBank'
	};
	  
	// 操作用户银行
	$('#goAddUserBank').click(function (){
		location.href = window.frontPath + 'home#user/goAddUserBank';
	});
	
	// 操作用户银行
	$('#goModUserBank').click(function (_id){
		location.href = window.frontPath + '#user/goModUserBank/' + _id;
	});
	$('#userBankList').delegate('[data-flag="data-user-blank"]' , 'click' , function (){
		var pTr = jQuery(this).parents("tr");
		var userBankId = $(pTr).attr('data-uid');//id
		var userBankStatus =  $(pTr).find('input[name="status"]:checked');//启用状态
		var userBankDefault = $(pTr).find('input[name="userBankDefault"]:checked');//默认
		$.ajax({
			url : CGI.SET_USER_BANK,
			method : 'POST',
			data : {id:userBankId,
				    userBankStatus:(userBankStatus?"Y":"N"),
				    userBankDefault:(userBankDefault?"Y":"N")},
			success : function(result) 
			{  
				if(result.retcode!='0')
			    {
			      return $.alert({
			    		status : 'error',
						basicTitle : result.retmsg
					});  
				}
				else
				{
					 $.alert({
				    		status : 'ok',
							basicTitle : '设置成功!'
						});  
				}
			}
		});
	});

})(window);